'''
|-----------------------------------------------
| builderPie buildClient interface webserver
|-----------------------------------------------
| Eric Henry
| Michigan State University
|
| GNU General Public License v3
| Creative Commons 3.0 BY-SA
------------------------------------------------
'''

import sys

def serve(port):
	import interface.HTTPServer
	import SocketServer
	import os

	os.chdir("./interface/public")

	server=interface.HTTPServer.HTTPRequestHandler
	socket=SocketServer.TCPServer(("",port), server)

	socket.serve_forever()
	
if __name__ == "__main__":
	try:
		port=int(sys.argv[1])
	except IndexError:
		port=8080

	serve(port)